#!/bin/sh
# Begin /etc/init.d/samba

### BEGIN INIT INFO
# Provides:            samba
# Required-Start:      $network
# Should-Start:        $remote_fs cups slapd ntpd
# Required-Stop:       $network
# Should-Stop:         $remote_fs cups slapd ntpd
# Default-Start:       3 4 5
# Default-Stop:        0 1 2 6
# Short-Description:   Provides SMB (Windows) networking.
# Description:         Starts Samba smbd and nmbd processess which provide
#                      connectivity to SMB (Windows) networks.
# X-LFS-Provided-By:   BLFS
### END INIT INFO

. /etc/rc.d/functions

#$LastChangedBy: krejzi $
#$Date: 2013-03-10 16:07:50 -0500 (Sun, 10 Mar 2013) $

case "$1" in
   start)
      mkdir -p /run/samba

      log_info_msg "Nmbd başlatılıyor..."
      start_daemon /usr/bin/nmbd -D
      evaluate_retval

      log_info_msg "Smbd başlatılıyor..."
      start_daemon /usr/bin/smbd -D
      evaluate_retval
      ;;

   stop)
      log_info_msg "Smbd durduruluyor..."
      killproc /usr/bin/smbd
      evaluate_retval

      log_info_msg "Nmbd durduruluyor..."
      killproc /usr/bin/nmbd
      evaluate_retval
      ;;

   reload)
      log_info_msg "Reloading smbd..."
      killproc /usr/bin/smbd -HUP
      evaluate_retval

      log_info_msg "Reloading nmbd..."
      killproc /usr/bin/nmbd -HUP
      evaluate_retval
      ;;

   restart)
      $0 stop
      sleep 1
      $0 start
      ;;

   status)
      statusproc /usr/bin/nmbd
      statusproc /usr/bin/smbd
      ;;

   *)
      echo "Kullanımı: $0 {start|stop|reload|restart|status}"
      exit 1
      ;;
esac

# End /etc/init.d/samba
